package top.zackyoung.springboot.controller

import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import top.zackyoung.springboot.entity.KotlinUser
import top.zackyoung.springboot.service.KotlinUserService
import javax.annotation.Resource

@RestController
@RequestMapping("/kotlin")
class KotlinController {
    @Resource
    var kotlinUserService:KotlinUserService?=null
    @RequestMapping("/test/{id}")
    fun String(@PathVariable("id") id: String): String {
        return "kotlin id is：$id"
    }
    @RequestMapping("/get/{id}")
    fun getId(@PathVariable("id") id: Long): KotlinUser? {
        return kotlinUserService?.getById(id)?.get()
    }
    @RequestMapping("/get2/{id}")
    fun get2Id(@PathVariable("id") id: Long): KotlinUser? {
        return kotlinUserService?.getByIdMP(id)?.get()
    }
}